﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Obvious.Framework.Notification.Interfaces;
using Obvious.Framework.Notification.Enums;
using Obvious.Framework.Notification.Implementation;
using Obvious.Framework.Notification.Abstracts;
using Obvious.Framework.Notification.ConfigHandlers;

namespace Obvious.Framework.Notification.Factory
{
    public class NotificationFactory
    {
        private NotificationFactory()
        {
        }

        public static NotificationProvider GetInstance()
        {
            return NotificationFactory.GetInstance(NotificationConfigHandler.ConfigSection.DefaultProvider);
        }

        public static NotificationProvider GetInstance(string configName)
        {
            NotificationProvider provider = null;
            NotificationProviderElement element = NotificationConfigHandler.GetProviderElement(configName);
            switch (element.Type)
            {
                case NotificationType.Email:
                    provider = (NotificationProvider)(new EmailNotificationAbstractProvider(configName));
                    break;
                case NotificationType.Fax:
                    break;
                case NotificationType.Sms:
                    break;
                case NotificationType.PhoneCall:
                    break;
                case NotificationType.Custom:
                    provider = CustomNotificationProviderActivator.Activate(element);
                    break;
                default:
                    break;
            }
            return provider;
        }

    }
}
